package sk.ogame.realm.utils;

import sk.ogame.entity.Building;

/**
 * @author 支绍昆
 * 2023/2/20
 * DESCRIPTION
 **/
public final class BuildingUtil {

    public static Building metalMine(int level) {
        double pow = Math.pow(1.5, level - 1);
        int metal = (int) Math.round(pow * 60);
        int crystal = (int) Math.round(pow * 15);

        pow = Math.pow(1.1, level);
        int output = (int) Math.round(pow * level * 30);
        int consume = (int) Math.round(pow * level * 10);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(output);
//        info.setConsume(consume);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(0);
        return info;
    }

    public static Building crystalMine(int level) {
        double pow = Math.pow(1.6, level - 1);
        int metal = (int) Math.round(pow * 48);
        int crystal = (int) Math.round(pow * 24);

        pow = Math.pow(1.1, level);
        int output = (int) Math.round(pow * level * 20);
        int consume = (int) Math.round(pow * level * 10);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(output);
//        info.setConsume(consume);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(0);
        return info;
    }

    public static Building deuteriumMine(int level) {
        double pow = Math.pow(1.5, level - 1);
        int metal = (int) Math.round(pow * 225);
        int crystal = (int) Math.round(pow * 75);

        pow = Math.pow(1.1, level);
        //每小时产量 = 10 * 等级 * （1.1 ^ 等级） * （-0.002 * 最高温度 + 1.28）
        int output = (int) Math.round(pow * level * 10);
        int consume = (int) Math.round(pow * level * 20);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(output);
//        info.setConsume(consume);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(0);
        return info;
    }

    public static Building solarPlant(int level) {
        double pow = Math.pow(1.5, level - 1);
        int metal = (int) Math.round(pow * 75);
        int crystal = (int) Math.round(pow * 30);

        pow = Math.pow(1.1, level);
        int output = (int) Math.round(pow * level * 20);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(output);
//        info.setConsume(0);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(0);
        return info;
    }

    public static Building fusionPlant(int level) {
        double pow = Math.pow(1.8, level - 1);
        int metal = (int) Math.round(pow * 900);
        int crystal = (int) Math.round(pow * 360);

        pow = Math.pow(1.1, level);
        int output = (int) Math.round(pow * level * 20);
        int consume = (int) Math.round(pow * level * 10);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(output);
//        info.setConsume(consume);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(0);
        return info;
    }

    public static Building roboticFactory(int level) {
        double pow = Math.pow(2, level);
        int metal = (int) Math.round(pow * 400);
        int crystal = (int) Math.round(pow * 120);
        int deuterium = (int) Math.round(pow * 200);

        Building info = new Building();
        info.setLevel(level);
//        info.setOutput(0);
//        info.setConsume(0);
        info.setMetal(metal);
        info.setCrystal(crystal);
        info.setDeuterium(deuterium);
        return info;
    }


}
